home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / pascal / freefnt.com / FREEFONT.DOC < prev   
Encoding:
Text File  |  1979-11-30  |  9.9 KB  |  287 lines

  1.  
  2. The 'FreeFont' package contains Turbo Pascal Units that work together with
  3. the Borland BGI to allow you to display text in any direction with any slant
  4. using BGI stroked fonts.  There are two units included.  FFONT50.TPU is the
  5. unit to be used with Turbo Pascal version 5.0 and contains the following
  6. procedures and functions :
  7.  
  8.  
  9. PROCEDURE FFSetTextStyle(pF:POINTER;Rotation:REAL;Size:REAL);
  10. PROCEDURE FFSetTextOptions(SlantAngle:REAL;isBold:BOOLEAN);
  11. PROCEDURE FFSetRotation(Rotation:REAL);
  12. PROCEDURE FFSetSlant(Slant:REAL);
  13. PROCEDURE FFSetSize(Size:REAL);
  14. PROCEDURE FFWriteHeader;
  15. FUNCTION FFCharWidth(ch:CHAR):INTEGER;
  16. FUNCTION FFTextWidth(S:STRING):INTEGER;
  17. FUNCTION FFTextHeight:INTEGER;
  18. PROCEDURE FFDrawChar(CH:CHAR);
  19. PROCEDURE FFStringOut(St:STRING);
  20. PROCEDURE FFStringOutXY(X,Y:INTEGER;S:STRING);
  21.  
  22.  
  23. For version 5.5, FFONT55.TPU defines the object 'FontObj' which has these
  24. methods defined :
  25.  
  26. PROCEDURE SetTextStyle(pF:POINTER;Rotation:REAL;Size:REAL);
  27. PROCEDURE SetTextOptions(SlantAngle:REAL;isBold:BOOLEAN);
  28. PROCEDURE ReadHeader;
  29. PROCEDURE SetRotation(Rotation:REAL);
  30. PROCEDURE SetSlant(Slant:REAL);
  31. PROCEDURE SetSize(Size:REAL);
  32. PROCEDURE WriteHeader;
  33. PROCEDURE GetRotatedXY(X,Y:INTEGER;var SX,SY:INTEGER);
  34. PROCEDURE GetSlantedXY(X,Y:INTEGER;var SX,SY:INTEGER);
  35. FUNCTION CharWidth(ch:CHAR):INTEGER;
  36. FUNCTION TextWidth(S:STRING):INTEGER;
  37. FUNCTION TextHeight:INTEGER;
  38. PROCEDURE DrawChar(CH:CHAR);
  39. PROCEDURE StringOut(St:STRING);
  40. PROCEDURE StringOutXY(X,Y:INTEGER;S:STRING);
  41.  
  42.  
  43. With the exception of the 'FF' preceding the procedures and functions in
  44. FFONT50.TPU, descriptions of both units are identical.
  45.  
  46.  
  47. **************************************************************************
  48.  
  49. PROCEDURE SetTextStyle(pF:POINTER;Rotation:REAL;Size:REAL);
  50.  
  51. PURPOSE - Initializes the font data structure.  SlantAngle is set to 0
  52.           and Bold is turned off.  Does not require a graphics video mode.
  53.  
  54.   **** MUST BE CALLED BEFORE ANY OTHER FREEFONT PROCEDURE OR FUNCTIONS !!
  55.  
  56. DESCRIPTION - pF points to a '.CHR' file that has been loaded into memory
  57.             or linked into your '.EXE' file.  See the RegisterBGIFont
  58.             function on page 359 of the Turbo Pascal Reference Guide for
  59.             a description of how to do this.
  60.  
  61.               Rotation is in degrees and starts with 0 being horizontal
  62.             and increasing in a counterclockwise direction.
  63.  
  64.               Size works the same way the BGI version does, with 4 as the
  65.             design size for each font.
  66.  
  67. EXAMPLE - FF.SetTextStyle(@aFont,30,8);
  68.           Initalizes the structure for 'aFont' going up from left to right
  69.           at double the normal size of the font.
  70.  
  71. **************************************************************************
  72.  
  73. PROCEDURE SetTextOptions(SlantAngle:REAL;isBold:BOOLEAN);
  74.  
  75. PURPOSE - Sets the SlantAngle and Bold switch.
  76.  
  77. DESCRIPTION - SlantAngle is in degrees and starts at 0, increasing in a
  78.               counterclockwise direction.
  79.  
  80.               isBold turns the Bold switch on or off.
  81.  
  82. EXAMPLE - FF.SetTextOptions(-15,true);
  83.           Prepares the current font for BOLD, ITALIC text.
  84.  
  85. **************************************************************************
  86.  
  87. PROCEDURE ReadHeader;
  88.  
  89. PURPOSE - Internal Use.  Not in the interface section of FFONT50.TPU.
  90.  
  91. DESCRIPTION - Procedure called by FF.SetTextStyle to load font data
  92.               into the structure.
  93.  
  94. EXAMPLE - NONE.
  95.  
  96. **************************************************************************
  97.  
  98. PROCEDURE SetRotation(Rotation:REAL);
  99.  
  100. PURPOSE - Sets the rotation value and initializes several internal
  101.           calculation variables.
  102.  
  103. DESCRIPTION - Rotation is in degrees and starts at 0, increasing in a
  104.               counterclockwise direction.
  105.  
  106. EXAMPLE - FF.SetRotation(180);
  107.           Sets rotation to horizontal, text displayed upside down.
  108.  
  109. **************************************************************************
  110.  
  111. PROCEDURE SetSlant(Slant:REAL);
  112.  
  113. PURPOSE - Sets the SlantAngle value and initializes several internal
  114.           calculation variables.
  115.  
  116. DESCRIPTION - Slant is in degrees with 0 being upright text, and increasing
  117.               in a counterclockwise direction.
  118.  
  119. EXAMPLE - FF.SetSlant(180);
  120.           Sets the slant angle to 180 degrees ( text displayed backwards ).
  121.  
  122. **************************************************************************
  123.  
  124. PROCEDURE SetSize(Size:REAL);
  125.  
  126. PURPOSE - Sets the Size of the text.
  127.  
  128. DESCRIPTION - Fonts are designed at a font size of 4.  A value of 8 will
  129.               display double size text.  Values below 3 yield poor quality
  130.               text.  Decimal values are permitted.
  131.  
  132. EXAMPLE - FF.SetSize(10);
  133.           Sets the Display size to 2.5 times design size.
  134.  
  135. **************************************************************************
  136.  
  137. PROCEDURE WriteHeader;
  138.  
  139. PURPOSE - Allows inspection of the data structure.
  140.  
  141. DESCRIPTION - Uses the textmode writeln() procedure to display the font
  142.               header data.
  143.  
  144. EXAMPLE - FF.WriteHeader;
  145.  
  146. **************************************************************************
  147.  
  148. PROCEDURE GetRotatedXY(X,Y:INTEGER;var SX,SY:INTEGER);
  149.  
  150. PURPOSE - Internal Use.  Not in the interface section of FFONT50.TPU.
  151.  
  152. DESCRIPTION - Procedure called by FF.DrawChar().
  153.  
  154. EXAMPLE - NONE.
  155.  
  156. **************************************************************************
  157.  
  158. PROCEDURE GetSlantedXY(X,Y:INTEGER;var SX,SY:INTEGER);
  159.  
  160. PURPOSE - Internal Use.  Not in the interface section of FFONT50.TPU.
  161.  
  162. DESCRIPTION - Procedure called by FF.DrawChar().
  163.  
  164. EXAMPLE - NONE.
  165.  
  166. **************************************************************************
  167.  
  168. FUNCTION CharWidth(ch:CHAR):INTEGER;
  169.  
  170. PURPOSE - Primarily for internal use.
  171.  
  172. DESCRIPTION - Gets the width of a character in pixels from the font
  173.               structure. DOES NOT ACCOUNT FOR SIZE !! Use FF.TextWidth to
  174.               determine the actual display width of text.
  175.  
  176. EXAMPLE - CW := CharWidth(CH);
  177.  
  178. **************************************************************************
  179.  
  180. FUNCTION TextWidth(S:STRING):INTEGER;
  181.  
  182. PURPOSE - Returns the width in pixels of a string.
  183.  
  184. DESCRIPTION - Uses FF.Charwidth and Size to calculate the display width
  185.               of a string.  This is NOT always going to be along the X axis
  186.               of the screen.
  187.  
  188. EXAMPLE - TW := FF.TextWidth(S);
  189.           String S is TW pixels wide regardless of it's direction.
  190.  
  191. **************************************************************************
  192.  
  193. FUNCTION TextHeight:INTEGER;
  194.  
  195. PURPOSE - Returns the height of the current font.
  196.  
  197. DESCRIPTION - Uses the font height from the font structure and the size
  198.               of the font to return the height of the text displayed.
  199.               This is NOT always going to be along the Y axis of the screen.
  200.  
  201. EXAMPLE - inc(Y,FF.TextHeight);
  202.           Increases the value of Y by the height of the current font.
  203.  
  204. **************************************************************************
  205.  
  206. PROCEDURE DrawChar(CH:CHAR);
  207.  
  208. PURPOSE - Primarily for internal use.
  209.  
  210. DESCRIPTION - Draws a character beginning at the current CP using the
  211.               current font's rotation, slant, bold attribute and size.
  212.  
  213. EXAMPLE - FF.DrawChar(CH);
  214.  
  215. **************************************************************************
  216.  
  217. PROCEDURE StringOut(St:STRING);
  218.  
  219. PURPOSE - Displays a string at the current CP using the BGI text
  220.           justification and color settings.
  221.  
  222. DESCRIPTION - Uses FF.DrawChar to display a string.
  223.  
  224. EXAMPLE - FF.StringOut('Hello World!');
  225.           Displays 'Hello World' at the CP.
  226.  
  227. **************************************************************************
  228.  
  229. PROCEDURE StringOutXY(X,Y:INTEGER;S:STRING);
  230.  
  231. PURPOSE - Displays a string at (X,Y) using the BGI text justification and
  232.           color settings.
  233.  
  234. DESCRIPTION - Uses FF.DrawChar to display a string.
  235.  
  236. EXAMPLE - FF.StringOutXY(10,100,'I LOVE using FreeFont !!');
  237.           Displays 'I LOVE using FreeFont !!' at (10,100).
  238.  
  239. **************************************************************************
  240.  
  241.  
  242. To obtain the source code for the FreeFont TPUs send $10.00 to :
  243.  
  244. Michael E. Garey
  245. 912 Blue Mountain Ln.
  246. Antioch, TN 37013
  247.  
  248. Please specify a 3.5" or 5.25" diskette.
  249.  
  250. Thank you and enjoy using FreeFont.
  251.  
  252. Michael E. Garey
  253.          ----------------end-of-author's-documentation---------------
  254.  
  255.                         Software Library Information:
  256.  
  257.                    This disk copy provided as a service of
  258.  
  259.                         The Public (Software) Library
  260.  
  261.          We are not the authors of this program, nor are we associated
  262.          with the author in any way other than as a distributor of the
  263.          program in accordance with the author's terms of distribution.
  264.  
  265.          Please direct shareware payments and specific questions about
  266.          this program to the author of the program, whose name appears
  267.          elsewhere in  this documentation. If you have trouble getting
  268.          in touch with the author,  we will do whatever we can to help
  269.          you with your questions. All programs have been tested and do
  270.          run.  To report problems,  please use the form that is in the
  271.          file PROBLEM.DOC on many of our disks or in other written for-
  272.          mat with screen printouts, if possible.  The P(s)L cannot de-
  273.          bug programs over the telephone.
  274.  
  275.          Disks in the P(s)L are updated monthly, so if you did not get
  276.          this disk  directly from the P(s)L,  you should be aware that
  277.          the files in this set may no  longer be the current versions.
  278.  
  279.          For a copy of the latest monthly software library newsletter
  280.          and a list of the 1,000+ disks in the library, call or write
  281.  
  282.                         The Public (Software) Library
  283.                               P.O.Box 35705
  284.                            Houston, TX 77235-5705
  285.                                (713) 665-7017
  286.  
  287.